﻿Public Class VisualUserSettings
    Inherits DependencyObject


 
    Public Property SplitterX As GridLength
        Get
            Return GetValue(SplitterXProperty)
        End Get
        Set(ByVal value As GridLength)
            SetValue(SplitterXProperty, value)
        End Set
    End Property

    Public Shared ReadOnly SplitterXProperty As DependencyProperty = _
                           DependencyProperty.Register("SplitterX", _
                           GetType(GridLength), GetType(VisualUserSettings), _
                           New UIPropertyMetadata(New GridLength(My.Settings.SplitterX, GridUnitType.Pixel)))

    Public Property SplitterY As GridLength
        Get
            Return GetValue(SplitterYProperty)
        End Get
        Set(ByVal value As GridLength)
            SetValue(SplitterYProperty, value)
        End Set
    End Property

    Public Shared ReadOnly SplitterYProperty As DependencyProperty = _
                           DependencyProperty.Register("SplitterY", _
                           GetType(GridLength), GetType(VisualUserSettings), _
                          New UIPropertyMetadata(New GridLength(My.Settings.SplitterY, GridUnitType.Pixel)))


    Protected Overrides Sub OnPropertyChanged(ByVal e As System.Windows.DependencyPropertyChangedEventArgs)
        My.Settings.SplitterY = SplitterY.Value
        My.Settings.SplitterX = SplitterX.Value
        MyBase.OnPropertyChanged(e)
    End Sub



    Public Property WindowHeight As Double
        Get
            Return GetValue(WindowHeightProperty)
        End Get

        Set(ByVal value As Double)
            SetValue(WindowHeightProperty, value)
        End Set
    End Property

    Public Shared ReadOnly WindowHeightProperty As DependencyProperty = _
                           DependencyProperty.Register("WindowHeight", _
                           GetType(Double), GetType(VisualUserSettings), _
                           New UIPropertyMetadata(My.Settings.WindowHeight))


    Public Property WindowWidth As Double
        Get
            Return GetValue(WindowWidthProperty)
        End Get

        Set(ByVal value As Double)
            SetValue(WindowWidthProperty, value)
        End Set
    End Property

    Public Shared ReadOnly WindowWidthProperty As DependencyProperty = _
                           DependencyProperty.Register("WindowWidth", _
                           GetType(Double), GetType(VisualUserSettings), _
                           New UIPropertyMetadata(My.Settings.WindowWidth))


    'Private Function ConGS(ByVal g As GridLength) As String
    '    Dim conv As New GridLengthConverter()
    'End Function
    'Private Function ConSG(ByVal s As String) As GridLength
    '    Dim conv As New GridLengthConverter()

    'End Function
    'Public Property SplitterX As String
    '    Get
    '        Return My.Settings.SplitterX
    '    End Get
    '    Set(ByVal value As String)
    '        My.Settings.SplitterX = value
    '    End Set
    'End Property
    'Public Property SplitterY As String
    '    Get
    '        Return My.Settings.SplitterY
    '    End Get
    '    Set(ByVal value As String)
    '        My.Settings.SplitterY = value
    '    End Set
    'End Property
End Class
